package cn.hznc.webstocket;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * @Author：Administrator
 * @Date：2024/2/29 15:57
 */
@RestController
@RequestMapping(value="/websocket")
public class WebSendController{

    @RequestMapping(value="/sendToOne", produces = {"application/json; charset=utf-8"},method= RequestMethod.POST)
    public void sendToOne(HttpServletRequest request, String message){
        String str = message;
        try {
            WebSocketServer.sendInfo(str);
        } catch (IOException e) {
// TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}
